/**
 * 课程组件样式
 * @description 课程相关组件的样式定义
 */

/* 课程卡片样式 */
.course-card {
  background-color: var(--color-bg-primary);
  border: 1px solid var(--color-border-secondary);
  border-radius: var(--border-radius-lg);
  padding: var(--spacing-md);
  transition: var(--transition-fast);
  cursor: pointer;
  position: relative;
  overflow: hidden;
}

.course-card::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  background-color: var(--course-color-1);
  transition: var(--transition-fast);
}

.course-card:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--color-primary);
  transform: translateY(-2px);
}

/* 课程颜色变体 */
.course-card.color-1::before { background-color: var(--course-color-1); }
.course-card.color-2::before { background-color: var(--course-color-2); }
.course-card.color-3::before { background-color: var(--course-color-3); }
.course-card.color-4::before { background-color: var(--course-color-4); }
.course-card.color-5::before { background-color: var(--course-color-5); }
.course-card.color-6::before { background-color: var(--course-color-6); }
.course-card.color-7::before { background-color: var(--course-color-7); }
.course-card.color-8::before { background-color: var(--course-color-8); }
.course-card.color-9::before { background-color: var(--course-color-9); }
.course-card.color-10::before { background-color: var(--course-color-10); }

.course-card.color-1:hover { border-color: var(--course-color-1); }
.course-card.color-2:hover { border-color: var(--course-color-2); }
.course-card.color-3:hover { border-color: var(--course-color-3); }
.course-card.color-4:hover { border-color: var(--course-color-4); }
.course-card.color-5:hover { border-color: var(--course-color-5); }
.course-card.color-6:hover { border-color: var(--course-color-6); }
.course-card.color-7:hover { border-color: var(--course-color-7); }
.course-card.color-8:hover { border-color: var(--course-color-8); }
.course-card.color-9:hover { border-color: var(--course-color-9); }
.course-card.color-10:hover { border-color: var(--course-color-10); }

.course-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--spacing-sm);
}

.course-card-title {
  font-size: var(--font-size-md);
  font-weight: var(--font-weight-semibold);
  color: var(--color-text-primary);
  margin: 0;
}

.course-card-actions {
  display: flex;
  gap: var(--spacing-xs);
}

.course-card-body {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-xs);
}

.course-card-info {
  display: flex;
  align-items: center;
  font-size: var(--font-size-sm);
  color: var(--color-text-secondary);
}

.course-card-info-icon {
  margin-right: var(--spacing-xs);
  color: var(--color-text-tertiary);
}

.course-card-footer {
  margin-top: var(--spacing-sm);
  padding-top: var(--spacing-sm);
  border-top: 1px solid var(--color-border-tertiary);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.course-card-categories {
  display: flex;
  gap: var(--spacing-xs);
  flex-wrap: wrap;
}

.course-category-tag {
  padding: 2px var(--spacing-xs);
  background-color: var(--color-primary-light);
  color: var(--color-primary);
  border-radius: var(--border-radius-sm);
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-medium);
  border: 1px solid transparent;
  transition: var(--transition-fast);
}

.course-category-tag:hover {
  background-color: var(--color-primary);
  color: #ffffff;
}

/* 课程分类标签颜色变体 */
.course-category-tag.category-primary {
  background-color: rgba(24, 144, 255, 0.1);
  color: var(--course-color-1);
  border-color: rgba(24, 144, 255, 0.2);
}

.course-category-tag.category-success {
  background-color: rgba(82, 196, 26, 0.1);
  color: var(--course-color-2);
  border-color: rgba(82, 196, 26, 0.2);
}

.course-category-tag.category-warning {
  background-color: rgba(250, 173, 20, 0.1);
  color: var(--course-color-3);
  border-color: rgba(250, 173, 20, 0.2);
}

.course-category-tag.category-error {
  background-color: rgba(245, 34, 45, 0.1);
  color: var(--course-color-4);
  border-color: rgba(245, 34, 45, 0.2);
}

.course-category-tag.category-purple {
  background-color: rgba(114, 46, 209, 0.1);
  color: var(--course-color-5);
  border-color: rgba(114, 46, 209, 0.2);
}

.course-category-tag.category-cyan {
  background-color: rgba(19, 194, 194, 0.1);
  color: var(--course-color-6);
  border-color: rgba(19, 194, 194, 0.2);
}

.course-color-indicator {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  margin-right: var(--spacing-xs);
}

/* 课程列表样式 */
.course-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: var(--spacing-md);
  padding: var(--spacing-md);
}

.course-list-empty {
  grid-column: 1 / -1;
  text-align: center;
  padding: var(--spacing-2xl);
  color: var(--color-text-tertiary);
}

/* 课程表单样式 */
.course-form {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-md);
  padding: var(--spacing-lg);
}

.course-form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--spacing-md);
}

.course-form-full {
  grid-column: 1 / -1;
}

.course-color-picker {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: var(--spacing-xs);
  margin-top: var(--spacing-xs);
}

.course-color-option {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  transition: var(--transition-fast);
}

.course-color-option:hover {
  transform: scale(1.1);
}

.course-color-option.selected {
  border-color: var(--color-text-primary);
  box-shadow: 0 0 0 2px var(--color-bg-primary);
}

/* 课程搜索样式 */
.course-search {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  padding: var(--spacing-md);
  background-color: var(--color-bg-secondary);
  border-radius: var(--border-radius-lg);
  margin-bottom: var(--spacing-md);
}

.course-search-input {
  flex: 1;
  padding: var(--spacing-sm) var(--spacing-md);
  border: 1px solid var(--color-border-primary);
  border-radius: var(--border-radius-md);
  background-color: var(--color-bg-primary);
  color: var(--color-text-primary);
}

.course-search-filters {
  display: flex;
  gap: var(--spacing-sm);
  align-items: center;
}

.course-filter-select {
  min-width: 120px;
}

/* 课程分类样式 */
.course-category-card {
  background-color: var(--color-bg-primary);
  border: 1px solid var(--color-border-secondary);
  border-radius: var(--border-radius-lg);
  padding: var(--spacing-md);
  transition: var(--transition-fast);
  cursor: pointer;
}

.course-category-card:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--color-primary);
}

.course-category-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--spacing-sm);
}

.course-category-name {
  font-size: var(--font-size-md);
  font-weight: var(--font-weight-semibold);
  color: var(--color-text-primary);
  margin: 0;
}

.course-category-count {
  background-color: var(--color-primary-light);
  color: var(--color-primary);
  padding: 2px var(--spacing-xs);
  border-radius: var(--border-radius-sm);
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-medium);
}

.course-category-description {
  font-size: var(--font-size-sm);
  color: var(--color-text-secondary);
  margin-bottom: var(--spacing-sm);
}

.course-category-actions {
  display: flex;
  gap: var(--spacing-xs);
  justify-content: flex-end;
}

/* 课程分类选择器样式 */
.course-category-selector {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-sm);
}

.course-category-options {
  display: flex;
  flex-wrap: wrap;
  gap: var(--spacing-xs);
}

.course-category-option {
  padding: var(--spacing-xs) var(--spacing-sm);
  border: 1px solid var(--color-border-primary);
  border-radius: var(--border-radius-md);
  background-color: var(--color-bg-primary);
  color: var(--color-text-primary);
  cursor: pointer;
  transition: var(--transition-fast);
  font-size: var(--font-size-sm);
}

.course-category-option:hover {
  border-color: var(--color-primary);
  color: var(--color-primary);
}

.course-category-option.selected {
  background-color: var(--color-primary);
  border-color: var(--color-primary);
  color: #ffffff;
}

.course-category-option:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* 响应式设计 */
@media (max-width: 768px) {
  .course-list {
    grid-template-columns: 1fr;
    gap: var(--spacing-sm);
    padding: var(--spacing-sm);
  }
  
  .course-form-row {
    grid-template-columns: 1fr;
    gap: var(--spacing-sm);
  }
  
  .course-search {
    flex-direction: column;
    align-items: stretch;
  }
  
  .course-search-filters {
    justify-content: space-between;
  }
  
  .course-color-picker {
    grid-template-columns: repeat(4, 1fr);
  }
  
  .course-category-options {
    flex-direction: column;
  }
  
  .course-category-option {
    text-align: center;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
  }
  
  /* 移动端课程卡片优化 */
  .course-card {
    padding: var(--spacing-sm);
  }
  
  .course-card-actions {
    flex-wrap: wrap;
  }
  
  .course-card-actions button {
    min-height: 36px;
    font-size: var(--font-size-xs);
  }
  
  /* 移动端搜索优化 */
  .course-search-input {
    font-size: 16px; /* 防止 iOS 缩放 */
    min-height: 44px;
  }
  
  .course-filter-select {
    min-width: auto;
    flex: 1;
  }
}

@media (max-width: 480px) {
  .course-card-header {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--spacing-xs);
  }
  
  .course-card-actions {
    align-self: flex-end;
  }
  
  .course-card-footer {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--spacing-xs);
  }
  
  .course-color-picker {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* 打印样式 */
@media print {
  .course-card-actions,
  .course-category-actions {
    display: none !important;
  }
  
  .course-card,
  .course-category-card {
    border: 1px solid #000 !important;
    box-shadow: none !important;
    break-inside: avoid;
  }
}

/* 高对比度模式 */
@media (prefers-contrast: high) {
  .course-card,
  .course-category-card {
    border-width: 2px;
  }
  
  .course-category-tag {
    border: 1px solid var(--color-primary);
  }
  
  .course-color-option {
    border-width: 3px;
  }
}

/* 动画效果 */
.course-card-enter {
  animation: courseCardEnter 0.3s ease-out;
}

.course-category-enter {
  animation: courseCategoryEnter 0.3s ease-out;
}

@keyframes courseCardEnter {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes courseCategoryEnter {
  from {
    opacity: 0;
    transform: translateX(-10px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* 减少动画模式 */
@media (prefers-reduced-motion: reduce) {
  .course-card-enter,
  .course-category-enter {
    animation: none;
  }
  
  .course-color-option:hover {
    transform: none;
  }
}